package com.ubxtech.annotation;

/**
 * @author Victor.Xiao
 * @since 2023-11-24 15:58
 **/
public enum RepeatValidateType {

    /** */
    PARAM("参数", 1),
    /** */
    TOKEN("token代表单个人的校验", 2);


    RepeatValidateType(String name, Integer code) {
        this.code = code;
        this.name = name;
    }

    private String name;
    private int code;

    public String getName() {
        return name;
    }

    public int getCode() {
        return code;
    }

    public static RepeatValidateType parse(int code) {
        for (RepeatValidateType type : RepeatValidateType.values()) {
            if (code == type.getCode()) {
                return type;
            }
        }
        return RepeatValidateType.PARAM;
    }
}
